﻿<navigation:Page x:Class="MedLink2011.Views.Dashboard.DashboardP" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
mc:Ignorable="d" 
d:DesignWidth="1024" 
d:DesignHeight="768"  
                 Style="{StaticResource PageStyle}"
                 
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
                 xmlns:appControls="clr-namespace:MedLink2011.Controls">
    <sdk:Page.Resources>
        <Style TargetType="TextBlock" x:Key="nameTextBlockStyle">
            <Setter Property="FontSize" Value="24" />
            <Setter Property="Foreground" Value="White" />
        </Style>
        <Style TargetType="sdk:Label" x:Key="labelStyle">
            <Setter Property="VerticalAlignment" Value="Top" />
            <Setter Property="HorizontalAlignment" Value="Right" />
            <Setter Property="Margin" Value="3,3,0,3" />
        </Style>
        <DataTemplate x:Key="patientEditTemplate">
            <StackPanel>
                <toolkit:DataField>
                    <TextBox Text="{Binding First_Name, Mode=TwoWay}" />
                </toolkit:DataField>
                <toolkit:DataField>
                    <TextBox Text="{Binding Last_Name, Mode=TwoWay}" />
                </toolkit:DataField>
                <toolkit:DataField>
                    <TextBox Text="{Binding HomePhoneNumber, Mode=TwoWay}" />
                </toolkit:DataField>
                <toolkit:DataField>
                    <TextBox Text="{Binding PersonalEmail, Mode=TwoWay}" />
                </toolkit:DataField>
                <toolkit:DataField>
                    <TextBox Text="{Binding DOB, Mode=TwoWay}" />
                </toolkit:DataField>
                <toolkit:DataField>
                    <TextBox Text="{Binding ISSS_Number, Mode=TwoWay}" />
                </toolkit:DataField>
                <toolkit:DataField>
                    <TextBox Text="{Binding NIT_Number, Mode=TwoWay}" />
                </toolkit:DataField>
                <toolkit:DataField PropertyPath="Photo" LabelStyle="{StaticResource labelStyle}">
                    <Button Click="GetPhotoButtonClick">
                        <Image Source="{Binding Path=Photo, Converter={StaticResource imageConverter}}" />
                    </Button>
                </toolkit:DataField>
            </StackPanel>
        </DataTemplate>

    </sdk:Page.Resources>
       <Grid x:Name="LayoutRoot" Background="AliceBlue">
            <Grid.RowDefinitions>
                <RowDefinition Height="256*" />
                <RowDefinition Height="256*" />
                <RowDefinition Height="91*" />
                <RowDefinition Height="165*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="5" />
                <ColumnDefinition Width="2*" />
                <ColumnDefinition Width="5" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <sdk:GridSplitter Grid.Column="1" Grid.RowSpan="3" HorizontalAlignment="Stretch" />
            <sdk:GridSplitter Grid.Column="3" Grid.RowSpan="3" HorizontalAlignment="Stretch" />
            <Grid Grid.RowSpan="2" x:Name="grid2" Grid.Column="2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="0.533*" />
                    <RowDefinition Height="0.467*" />
                </Grid.RowDefinitions>
                <sdk:GridSplitter x:Name="gridSplitter1" HorizontalAlignment="Stretch" Height="5" VerticalAlignment="Bottom" Margin="0,0,0,5" />
                <TextBlock Text="Consultas:" Grid.Column="3" Grid.Row="0" Margin="4" FontWeight="Bold" VerticalAlignment="Top"/>
            <appControls:BusyIndicator x:Name="ConsultationBusyIndicator" BusyContent="Loading Consultations data...." Foreground="SlateGray" IsBusy="{Binding IsBusy}" Margin="0,24,0,14">
                <sdk:DataGrid ItemsSource="{Binding ConsultationCollection, Mode=TwoWay}" AutoGenerateColumns="False" x:Name="consultationsDataGrid"  RowDetailsVisibilityMode="VisibleWhenSelected"   Style="{StaticResource DataGridCellJetPackStyle}"  CellStyle="{StaticResource LeftCell}" ColumnHeaderStyle="{StaticResource DataGridColumnHeader}" RowHeaderStyle="{StaticResource DataGridRowHeader}" RowStyle="{StaticResource DataGridRow}">
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn  Binding="{Binding Date, StringFormat=\{0:d\}}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Date" Width="Auto" />
                        <sdk:DataGridTextColumn Binding="{Binding Temperature}"  Header="Temperature" Width="SizeToHeader" />
                        <sdk:DataGridTextColumn Binding="{Binding Doctor_Id}"  Header="Doctor Id" Width="SizeToHeader" />
                        <sdk:DataGridTextColumn Binding="{Binding Blood_Pressure_Systolic}"  Header="Systolic" Width="SizeToHeader" />
                        <sdk:DataGridTextColumn Binding="{Binding Blood_Pressure_Diastolic}"  Header="Diastolic" Width="SizeToHeader" />
                        <sdk:DataGridTextColumn Binding="{Binding Pulse}"  Header="Pulse" Width="SizeToHeader" />
                        <sdk:DataGridTextColumn Binding="{Binding Cholesterol}"  Header="Cholesterol" Width="SizeToHeader" />
                        <sdk:DataGridTextColumn Binding="{Binding Triglicerides}"  Header="Triglicerides" Width="SizeToHeader" />
                        <sdk:DataGridTextColumn Binding="{Binding HDL}"  Header="HDL" Width="SizeToHeader" />
                        <sdk:DataGridTextColumn Binding="{Binding LDL}"  Header="LDL" Width="SizeToHeader" />
                    </sdk:DataGrid.Columns>
                </sdk:DataGrid>
            </appControls:BusyIndicator>
        </Grid>
        
        <TextBlock  Text="Diagnosis:" Grid.Column="4" Grid.Row="0" Margin="4" FontWeight="Bold" VerticalAlignment="Top"/>
        <appControls:BusyIndicator x:Name="DiagnoBusyIndicator" BusyContent="Loading Diagnosis data...." Foreground="SlateGray" IsBusy="{Binding IsBusy}" Grid.Column="4" Margin="0,24,0,0" >
            <sdk:DataGrid ItemsSource="{Binding DiagnoCollection, Mode=TwoWay}" AutoGenerateColumns="False"  x:Name="diagnosisDataGrid"   Style="{StaticResource DataGridCellJetPackStyle}" CellStyle="{StaticResource LeftCell}" ColumnHeaderStyle="{StaticResource DataGridColumnHeader}" RowHeaderStyle="{StaticResource DataGridRowHeader}" RowStyle="{StaticResource DataGridRow}"  >
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Binding="{Binding Date, StringFormat=\{0:d\}}" Header="Date" Width="80" />
                    <sdk:DataGridTextColumn Binding="{Binding Description}"  Header="Description" Width="SizeToHeader" />
                    <sdk:DataGridTextColumn Binding="{Binding Status}"  Header="Status" Width="SizeToHeader" />
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
        </appControls:BusyIndicator>
        
            <TextBlock Text="Recetas:" Grid.Column="4" Grid.Row="1" Margin="4" FontWeight="Bold" VerticalAlignment="Top"/>
        <appControls:BusyIndicator x:Name="PrescriptionBusyIndicator" BusyContent="Loading Prescription data...." Foreground="SlateGray" IsBusy="{Binding IsBusy}" Grid.Column="4" Grid.Row="1" Margin="0,24,0,0">
            <sdk:DataGrid ItemsSource="{Binding PrescriptionCollection, Mode=TwoWay}" AutoGenerateColumns="False"  x:Name="prescriptionDataGrid"   Style="{StaticResource DataGridCellJetPackStyle}" CellStyle="{StaticResource LeftCell}" ColumnHeaderStyle="{StaticResource DataGridColumnHeader}" RowHeaderStyle="{StaticResource DataGridRowHeader}" RowStyle="{StaticResource DataGridRow}"  >
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Binding="{Binding Common_Name}" Header="Common_Name" Width="SizeToHeader" />
                    <sdk:DataGridTextColumn Binding="{Binding Generic_Name}"  Header="Description" Width="SizeToHeader" />
                    <sdk:DataGridTextColumn Binding="{Binding Active_Ingredient}"  Header="Status" Width="SizeToHeader" />
                    <sdk:DataGridTextColumn Binding="{Binding Instructions}"  Header="Instructions" Width="SizeToHeader" />
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
        </appControls:BusyIndicator>
        <TextBlock Text="Labs:" Grid.Column="4" Grid.Row="2" Margin="4" FontWeight="Bold" VerticalAlignment="Top"/>
        <appControls:BusyIndicator x:Name="LabBusyIndicator" BusyContent="Loading Labs data...." Foreground="#89A0B6" IsBusy="{Binding IsBusy}" Grid.Column="4" Grid.Row="2" Grid.RowSpan="2" Margin="0,24,0,0">
           <sdk:DataGrid ItemsSource="{Binding LabCollection, Mode=TwoWay}" AutoGenerateColumns="False"  x:Name="labTestDataGrid"      Style="{StaticResource DataGridCellJetPackStyle}" CellStyle="{StaticResource LeftCell}" ColumnHeaderStyle="{StaticResource DataGridColumnHeader}" RowHeaderStyle="{StaticResource DataGridRowHeader}" RowStyle="{StaticResource DataGridRow}" >
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Binding="{Binding Date_Requested, StringFormat=\{0:dddd MMMM d yyyy HH:mm:ss\}}" Header="Date Requested" Width="180" />
                    <sdk:DataGridTextColumn Binding="{Binding Description}"  Header="Description" Width="SizeToHeader" />
                    <sdk:DataGridTextColumn Binding="{Binding Pathologist}"  Header="Pathologist" Width="SizeToHeader" />
                    <sdk:DataGridTextColumn Binding="{Binding Results}"  Header="Results" Width="SizeToHeader" />
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
</appControls:BusyIndicator>
            <TextBlock Text="Paciente:" Grid.Column="0" Grid.Row="0" Margin="4" FontWeight="Bold" VerticalAlignment="Top"/>
        <appControls:BusyIndicator x:Name="PatientBusyIndicator" BusyContent="Loading Patients data...." Foreground="SlateGray" IsBusy="{Binding IsBusy}" Margin="0,24,0,0" >
            <!--<ScrollViewer  VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" >-->
            <toolkit:DataForm ItemsSource="{Binding PatientCollection, Mode=TwoWay}" x:Name="patientDataForm" EditTemplate="{StaticResource patientEditTemplate}" Style="{StaticResource DataFormStyle}" EditEnded="patientDataForm_EditEnded" CommandButtonsVisibility="Cancel, Commit, Edit" AutoCommit="False"  />
            <!--</ScrollViewer>-->
        </appControls:BusyIndicator>
        <toolkit:Chart Grid.Column="0" Grid.Row="1" x:Name="ChartBMI" Title="BMI">
                <toolkit:Chart.DataContext>
                    <PointCollection>
                        <Point>1,10</Point>
                        <Point>2,20</Point>
                        <Point>3,30</Point>
                        <Point>4,40</Point>
                    </PointCollection>
                </toolkit:Chart.DataContext>
            <toolkit:LineSeries IndependentValuePath="Date" ItemsSource="{Binding ConsultationCollection, Mode=TwoWay}"  DependentValueBinding="{Binding Converter={StaticResource bmiConverter}}"/>
            </toolkit:Chart>
        <toolkit:Chart Grid.Row="2" Grid.Column="0" x:Name="ChartBloodPressure" Title="Blood Pressure"  Grid.RowSpan="2">
                <toolkit:Chart.DataContext>
                    <PointCollection>
                        <Point>1,10</Point>
                        <Point>2,20</Point>
                        <Point>3,30</Point>
                        <Point>4,40</Point>
                    </PointCollection>
                </toolkit:Chart.DataContext>
            <toolkit:LineSeries IndependentValuePath="Date" ItemsSource="{Binding ConsultationCollection, Mode=TwoWay}" DependentValuePath="Blood_Pressure_Systolic" />
            <toolkit:LineSeries IndependentValuePath="Date" ItemsSource="{Binding ConsultationCollection, Mode=TwoWay}" DependentValuePath="Blood_Pressure_Diastolic" />
            </toolkit:Chart>
    </Grid>
    
</navigation:Page>